import request from "@/libs/request";

/**
 * 字典树
 * @param params
 * @returns {*}
 */
export const dictTree= (params) => {
  return request({
    url:'/sys/dict/buildDictTree',
    method: 'get',
    params
  })
}
/**
 * 保存字典
 * @param data
 * @returns {*}
 */
export const saveDict=(data) =>{
  return request({
    url:'/sys/dict',
    method:'post',
    data
  })
}
/**
 * query dict item list
 * @param params
 * @returns {*}
 */
export const findDictItemList=(params)=>{
   return request({
     url:'/sys/item',
     method:'get',
     params
   })
}
/**
 * 保存字典值
 * @param data
 * @returns {*}
 */
export const saveDictItem=(data) =>{
  return request({
    url:'/sys/item',
    method:'post',
    data
  })
}
/**
 * 修改字典值
 * @param data
 * @returns {*}
 */
export const updateDictItem=(data) =>{
  return request({
    url:'/sys/item',
    method:'put',
    data
  })
}
/**
 * 修改字典
 * @param data
 * @returns {*}
 */
export const updateDict=(data) =>{
  return request({
    url:'/sys/dict',
    method:'put',
    data
  })
}
/**
 * 删除字典
 * @param id
 * @returns {*}
 */
export const deleteDict=(id) =>{
  return request({
    url:`/sys/dict/${id}`,
    method:'delete',
  })
}
/**
 * 删除字典值
 * @param params
 * @returns {*}
 */
export const deleteDictItem=(params) =>{
  return request({
    url:'/sys/item',
    method:'delete',
    params
  })
}
